<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

<c:set var="ctx" value="${pageContext.request.contextPath}" />
<c:set var="queryList" value="${pageContext.request.contextPath}/role/list" />
<script type="text/javascript"
	src="${ctx}/static/js/jquery-1.8.3.min.js"></script>

    	<div class="iframe-cot pull-right" id="smIframe" style="background:#FFFFFF;">
                
             <div class="right-form">
             <form id="_query_form" action="" class="form-inline" onsubmit="return false;">
                  <div class="tb_search">
                  	<div class="pull-left">
              			<span class="search-more">更多条件<i class="fa fa-angle-down ml5"></i></span>
                          <div class="form-group">
                          <label for="roleName">角色名称：</label>
							<input type="text"  name="roleName" value="${fn:escapeXml(roleName) }" />
                          </div>
						<div class="form-group">
                          <label for="roleType">角色类型：</label>
							<select name="roleType" class="form-control-select" >
								<option value="" >请选择</option>
								  <c:forEach items="${roleTypeList}" var="rt">
									<option value="${rt.code }" <c:if test="${rt.code eq roleType }"  >selected</c:if> >${rt.name }</option>
								</c:forEach>  
							</select>
                         </div>

                      
                    </div>
                </div>
                </form>
             </div>
             
             <div class="line-e6e"></div>
             
             <div class="form-top">
                  <div class="pull-left">
                    <!--   <button class="btn btn-default" onclick="goAdd('${ctx}/role/add','新增角色')"><i class="fa fa-plus mr5"></i>新增</button> 
                  	  <button class="btn btn-default" onclick="goUpdate('${ctx}/role/edit','修改角色信息')"><i class="fa fa-pencil mr5"></i>编辑</button>
                  	  -->
                  	   <shiro:hasPermission name="common-service-role:grantApps">
                  	     <button class="btn btn-default" onclick="goApp()"><i class="fa fa-pencil mr5"></i>赋应用</button>
                  	   </shiro:hasPermission>
                  	  <shiro:hasPermission name="common-service-role:grantPermisson">
                  	   <button class="btn btn-default" onclick="goPermission()"><i class="fa fa-pencil mr5"></i>授权</button>
                  	 </shiro:hasPermission>
					<%--  <shiro:hasPermission name="common-service-role:delete">
                       <button class="btn btn-default" onclick="deleteBatch('${ctx}/role/delete')"><i class="fa fa-times mr5"></i>删除</button>
                     </shiro:hasPermission>  --%>
                  
                  </div>
                  <div class="pull-right">
                  <shiro:hasPermission name="common-service-role:query">
                      <a class="btn btn-orange" onclick="changePage('${queryList }/table','#_query_form','1','${pageBean.pageSize }',0,true)"><i class="fa fa-search mr5"></i>查询</a>
                      <a class="btn btn-blue" onclick="clearForm('#_query_form');"><i class="fa fa-trash-o mr5"></i>清空</a>
                 </shiro:hasPermission>
                  </div>
             </div>
            <div id="table-papination">
            	
            </div>
      </div>          

          <!--main end--> 
 <script src="${ctx}/static/js/search-more.js"></script>  <!--更多查询条件-->     
 <script type="text/javascript">

 currentPageNo = parseInt('${pageBean.currentPage}');
 currentPageSize = parseInt('${pageBean.pageSize }');
 totalPageCount = parseInt('${pageBean.totalPage}');
 queryUrl = '${ctx}/role/list';
 
 $(document).ready(function(){
	 loadConent('${queryList }/table','',true);
 });
 
 function goApp(){
	 var roleId = getListTableCheckboxValue() ;
	 if( roleId == '' || roleId.split(",").length>1){
		 warnTip('请选择一条记录');
		 return;
	 }
	 var _url = "${ctx}/role/open/app/page/"+roleId;
	 	layer.open({
		    type: 2,
		    title: "赋应用",
		    maxmin: false,
		    shadeClose: false, //点击遮罩关闭层
		    area : ['850px' , '550px'],
		    content: _url
		}); 
 }
 function goPermission(){
	    
	    var roleId = getListTableCheckboxValue() ;
		 if( roleId == '' || roleId.split(",").length>1){
			 warnTip('请选择一条记录');
			 return;
		 }
	  var _url = "${ctx}/role/permission/page/"+roleId;
	 	layer.open({
		    type: 2,
		    title: "角色授权",
		    maxmin: false,
		    shadeClose: false, //点击遮罩关闭层
		    area : ['800px' , '600px'],
		    content: _url
		}); 
		
	   
		
	}
 </script>